Clip the rectangle to be rendered to the drawable, since
authorHavoc Pennington <hp@redhat.com>
Wed, 1 Nov 2000 16:34:23 +0000 (16:34 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Wed, 1 Nov 2000 16:34:23 +0000 (16:34 +0000)
2000-11-01  Havoc Pennington  <hp@redhat.com>

* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
Clip the rectangle to be rendered to the drawable, since
get_from_drawable() requires a region within the drawable

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/gdkpixbuf-render.c

index 433258998fc0c11016ee14e000cd6c9a76dda9d3..9ae227850d765878013e50f17edaac47aa2476c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+       Clip the rectangle to be rendered to the drawable, since
+       get_from_drawable() requires a region within the drawable       
+
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
index 433258998fc0c11016ee14e000cd6c9a76dda9d3..9ae227850d765878013e50f17edaac47aa2476c4 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+       Clip the rectangle to be rendered to the drawable, since
+       get_from_drawable() requires a region within the drawable       
+
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
index 433258998fc0c11016ee14e000cd6c9a76dda9d3..9ae227850d765878013e50f17edaac47aa2476c4 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+       Clip the rectangle to be rendered to the drawable, since
+       get_from_drawable() requires a region within the drawable       
+
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
index 433258998fc0c11016ee14e000cd6c9a76dda9d3..9ae227850d765878013e50f17edaac47aa2476c4 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+       Clip the rectangle to be rendered to the drawable, since
+       get_from_drawable() requires a region within the drawable       
+
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
index 433258998fc0c11016ee14e000cd6c9a76dda9d3..9ae227850d765878013e50f17edaac47aa2476c4 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+       Clip the rectangle to be rendered to the drawable, since
+       get_from_drawable() requires a region within the drawable       
+
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
index 433258998fc0c11016ee14e000cd6c9a76dda9d3..9ae227850d765878013e50f17edaac47aa2476c4 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+       Clip the rectangle to be rendered to the drawable, since
+       get_from_drawable() requires a region within the drawable       
+
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
index 433258998fc0c11016ee14e000cd6c9a76dda9d3..9ae227850d765878013e50f17edaac47aa2476c4 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+       Clip the rectangle to be rendered to the drawable, since
+       get_from_drawable() requires a region within the drawable       
+
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
index 9ef7bb6f6bc0bbb2ff2f295565eff2b88fc381d0..cb4b9ea2bf4fbf72dc246474e68f2959b1372182 100644 (file)
@@ -266,6 +266,8 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf   *pixbuf,
   GdkBitmap *bitmap = NULL;
   GdkGC *gc;
   GdkPixbuf *composited = NULL;
+  gint dwidth, dheight;
+
   
   g_return_if_fail (pixbuf != NULL);
   g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
@@ -277,9 +279,37 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf   *pixbuf,
   g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
   g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
 
-  if (width == 0 || height == 0)
+  /* Clip to the drawable; this is required for get_from_drawable() so
+   * can't be done implicitly
+   */
+  
+  if (dest_x < 0)
+    {
+      src_x -= dest_x;
+      width += dest_x;
+      dest_x = 0;
+    }
+
+  if (dest_y < 0)
+    {
+      src_y -= dest_y;
+      height += dest_y;
+      dest_y = 0;
+    }
+
+  gdk_drawable_get_size (drawable, &dwidth, &dheight);
+
+  if ((dest_x + width) > dwidth)
+    width = dwidth - dest_x;
+
+  if ((dest_y + height) > dheight)
+    height = dheight - dest_y;
+
+  if (width <= 0 || height <= 0)
     return;
 
+  /* Actually draw */
+  
   gc = gdk_gc_new (drawable);
 
   if (pixbuf->has_alpha)